package com.health.controller;

import com.health.pojo.CheckItem;
import com.health.service.CheckItemService;
import com.health.vo.PageResult;
import com.health.vo.Result;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "检查项相关接口")
@ApiResponses({
        @ApiResponse(code = 200, message = "请求正常", response = Result.class)
})
@RestController
@RequestMapping("/checkItem")
public class CheckItemController {

    @Resource
    private CheckItemService checkItemService;

    @ApiOperation("检查项分页条件查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "token令牌", paramType = "header", required = true),
            @ApiImplicitParam(name = "pageNow", value = "页码", required = true),
            @ApiImplicitParam(name = "pageSize", value = "行数", required = true),
            @ApiImplicitParam(name = "query", value = "项目编码或项目名称")
    })
    @GetMapping("/findPage/{pageNow}/{pageSize}")
    public Result findPage(@PathVariable Integer pageNow, @PathVariable Integer pageSize, String query) {
        PageResult<CheckItem> pageResult = checkItemService.findPage(pageNow, pageSize, query);

        //封装返回结果
        return new Result(true, "检查项分页查询成功", pageResult);
    }
}
